Blog

Luis Majano

July 13, 2009

Spread the word


Share your thoughts

As you have probably read a few days ago we released LogBox: An enterprise ColdFusion Logging Library, part of the new ColdBox 3.0.0 Platform Suite.   The library's core of logging takes place thanks to its appenders that send messages to different destinations.  As of now, the distribution has 11 appenders included, but if you want to build your own, you can very very easily.  Not only that, since we are in Beta, you can submit your appenders and we will include them in the distribution if they are cool!  So here is a little tip and trick on building appenders:

Appender

An appender is an object that LogBox uses in order to log statements to a destination repository. All appenders act as destinations that can be from databases, JMS, Twitter, files, consoles, sockets, etc. Their job is to take the logged message and store it or send it somewhere. LogBox comes bundled with the following appenders that can be found in the package coldbox.system.logging.appenders:

Appender Description
AsyncFileAppender An Asynchronous file appender
AsyncRollingFileAppender An Asynchronous file appender that can do file rotation and archiving
CFAppender Will deliver messages to the coldfusion logs
ConsoleAppender Will deliver messages to the console via system.out
DBAppender Will deliver messages to a database table. It can even auto create the table for you.
EmailAppender Will deliver messages to any email address
FileAppender Will deliver messages a file
RollingFileAppender A file appender that can do file rotation and archiving
ScopeAppender Will deliver messages to any ColdFusion scope you desire
SocketAppender Will connect to any server socket and deliver messages
TwitterAppender Can either send direct messages to a twitter user or update a status of a twitter user.

 

You can define 1 or all of these appenders in LogBox at any point in time. You can even register as many instances of any appender by just naming them differently. 

 

In order to create your own appenders, you will have to create a cfc that extends coldbox.system.logging.AbstractAppender and implement the following methods:

  • init() : Your constructor
  • logMessage() : The method that is called when a message is received
  • onRegistration() : An interceptor that fires when the appender gets created and initialized. It can be used for preparing the appender for operation.
  • onUnRegistration() : An interceptor that fires when the appender is removed from a logger.

 

So how easy is it, well take a look at this simple console appender.

 

// Init supertype super.init(argumentCollection=arguments); instance.out = createObject("java","java.lang.System").out; return this; var loge = arguments.logEvent; var entry = ""; if( hasCustomLayout() ){ entry = getCustomLayout().format(loge); } else{ entry = "#severityToString(loge.getseverity())# #loge.getCategory()# #loge.getmessage()# ExtraInfo: #loge.getextraInfoAsString()#"; } // Log message instance.out.println(entry);

Add Your Comment

(2)

Jul 14, 2009 00:18:08 UTC

by Will B.

Does this use an interface? Heh. - WB

Jul 14, 2009 10:59:30 UTC

by Luis Majano

Heh!! Acutally it is an abstract class as functionality needed to be passed down and also, needed to be cf7 compatible (YUCK!!) Adobe, please discountinue support for cf7

Recent Entries

The CFML Talent Crunch in 2025: Why Modernization Can’t Wait

The CFML Talent Crunch in 2025: Why Modernization Can’t Wait

How organizations can stay competitive when CFML expertise is harder to find than ever?

1. The Silent Crisis: CFML Talent Is Disappearing

For many organizations, ColdFusion and CFML applications still power critical business processes.

But there’s a growing challenge that leaders can no longer ignore:

The number of experienced CFML developers is shrinking—and it’s happening fast.

Why?

  • Few new devel...

Cristobal Escobar
Cristobal Escobar
December 09, 2025
HTTP Superpowers: BoxLang's New Fluent HTTP API

HTTP Superpowers: BoxLang's New Fluent HTTP API

New in BoxLang 1.8.0 - Say goodbye to verbose HTTP request building. BoxLang introduces a powerful fluent HTTP API that makes working with HTTP/S requests not just easier, but actually enjoyable.

Luis Majano
Luis Majano
December 09, 2025
CFCamp Pre-Conference Workshops led by Ortus Solutions!

CFCamp Pre-Conference Workshops led by Ortus Solutions!

We’re excited to announce the Pre-Conference Workshops for CFCamp 2026, Europe’s CFML-focused conference! Join us on June 16–17, 2026 at the Atomis Hotel Munich Airport by Mercure, Oberding for a deep dive into modern CFML and BoxLang development.

These workshops are the perfect opportunity to get hands-on training from the experts, level up your skills, and explore the future of CFML development before the main conference kicks off on June 18–19.

Maria Jose Herrera
Maria Jose Herrera
December 08, 2025